<?php
/* @var $this DonationController */
/* @var $model Donation */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'donation-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'donation_number'); ?>
		<?php echo $form->textField($model,'donation_number'); ?>
		<?php echo $form->error($model,'donation_number'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'donation_amount'); ?>
		<?php echo $form->textField($model,'donation_amount'); ?>
		<?php echo $form->error($model,'donation_amount'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'donation_name'); ?>
		<?php echo $form->textField($model,'donation_name',array('size'=>45,'maxlength'=>45)); ?>
		<?php echo $form->error($model,'donation_name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'donation_address'); ?>
		<?php echo $form->textField($model,'donation_address',array('size'=>45,'maxlength'=>45)); ?>
		<?php echo $form->error($model,'donation_address'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'donation_date'); ?>
		<?php 
$form->widget('zii.widgets.jui.CJuiDatePicker', array(
'model'=>$model,
'attribute'=>'donation_date',
'name'=>$model->donation_date, // This is how it works for me.
'value'=>$model->donation_date,
'options'=>array('dateFormat'=>'yy-mm-dd', 
'altFormat'=>'dd-mm-yy', 
'changeMonth'=>'true', 
'changeYear'=>'true', 
'yearRange'=>'1920:2010', 
'showOn'=>'both',
'buttonText'=>'...'),
'htmlOptions'=>array('size'=>'10')
));
?>
		<?php echo $form->error($model,'donation_date'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'paypal_id'); ?>
		<?php echo $form->dropDownList ($model, 'paypal_id', CHtml::listData(
		Paypal::model()->findAll(), 'id','paypal_account'),
			array('prompt' => 'Paypal Account')
			); ?>
		<?php echo $form->error($model,'paypal_id'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'location_id'); ?>
		<?php echo $form->dropDownList ($model, 'location_id', CHtml::listData(
		Location::model()->findAll(), 'id','location'),
			array('prompt' => 'Location')
			); ?>
		<?php echo $form->error($model,'location_id'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->